package org.deadline.service.baseapp;

import java.util.List;
import org.deadline.model.baseapp.NotificationShedule;
import org.deadline.repository.baseapp.NotificationSheduleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
@Transactional
public class NotificationSheduleServiceImpl implements NotificationSheduleService {

	@Autowired
    NotificationSheduleRepository notificationSheduleRepository;

	public long countAllNotificationShedules() {
        return notificationSheduleRepository.count();
    }

	public void deleteNotificationShedule(NotificationShedule notificationShedule) {
        notificationSheduleRepository.delete(notificationShedule);
    }

	public NotificationShedule findNotificationShedule(Long id) {
        return notificationSheduleRepository.findOne(id);
    }

	public List<NotificationShedule> findAllNotificationShedules() {
        return notificationSheduleRepository.findAll();
    }

	public List<NotificationShedule> findNotificationSheduleEntries(int firstResult, int maxResults) {
        return notificationSheduleRepository.findAll(new org.springframework.data.domain.PageRequest(firstResult / maxResults, maxResults)).getContent();
    }

	public void saveNotificationShedule(NotificationShedule notificationShedule) {
        notificationSheduleRepository.save(notificationShedule);
    }

	public NotificationShedule updateNotificationShedule(NotificationShedule notificationShedule) {
        return notificationSheduleRepository.save(notificationShedule);
    }
}
